package com.lepu.app.fun.tool.bbxxjs;

import android.content.Intent;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.app.utils.Setting;
import com.core.lib.application.BaseFragmentActivity;
import com.core.lib.utils.main.UtilityBase;
import com.eyzhs.app.R;
import com.lepu.app.fun.tool.bbcsz.bean.BeanToolBbcs;
import com.lepu.app.main.activity.AppBroswerActivity;
import com.lepu.app.widget.CustomTopBarNew;
import com.lepu.app.widget.CustomTopBarNew.OnTopbarNewLeftLayoutListener;

public class BbxxjsResultActivity extends BaseFragmentActivity implements
		OnTopbarNewLeftLayoutListener {

	@Override
	public void onCreate(Bundle savedInstanceState) {

		mNeedStatusBar = false;
		super.onCreate(savedInstanceState);
		setContentView(R.layout.index_bbxxjs_result_activity);

		UtilityBase.setStatusBarRes(this, R.color.color_bmi, true);
		init();
	}

	@Override
	public void onDestroy() {
		super.onDestroy();
	}

	/**
	 * 添加页面动画，需要重写这个方法，
	 */
	@Override
	public void onBackPressed() {
		finish(true);
	}
	
	@Override
	public void onTopbarLeftLayoutSelected() {
		finish(true);
	}


	/**
	 * 初始化方法
	 */
	private void init() {
		// topbar
		CustomTopBarNew topbar = (CustomTopBarNew) findViewById(R.id.topbar);
		topbar.setTopbarTitle("宝宝血型计算器");
		topbar.setTopbarBackground(R.color.color_bmi);
		topbar.setonTopbarNewLeftLayoutListener(this);

		TextView bottomTipTextView = (TextView) findViewById(R.id.bottomTipTextView);
		bottomTipTextView.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
		bottomTipTextView.getPaint().setAntiAlias(true);

		String resultCan = "";
		String resultNoCan = "";
		Bundle data = getIntent().getExtras();
		if(data != null && data.size() > 0){
			resultCan = data.getString("resultCan");
			resultNoCan = data.getString("resultNoCan");
		}

		TextView result1TextView = (TextView) findViewById(R.id.result1TextView);
		TextView result2TextView = (TextView) findViewById(R.id.result2TextView);

		result1TextView.setText(resultCan);
		result2TextView.setText(String.format("不可能为：%s",resultNoCan));
	}

	public void viewClick(View view){
		int rid = view.getId();
		switch (rid)
		{
			case R.id.bottomTipTextView:

				Intent intent = new Intent(this, AppBroswerActivity.class);
				intent.putExtra("url", Setting.getBabyXingGeUrl());//test
				intent.putExtra("top_color_id",R.color.color_bmi);
				startActivity(intent, true);
				break;
			case R.id.finishButton:

				finish(true);
				break;
			default:
				break;
		}
	}
}
